﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using POSSystem.DAL;

namespace POSSystem.BLL
{
    public class View_InvoicePaymentHist :_View_InvoicePaymentHist
    {
        public static View_InvoicePaymentHist GetPaymentHistories(int invoiceID)
        {
            try
            {
                View_InvoicePaymentHist hist = new View_InvoicePaymentHist();
                hist.Where.InvoiceID.Value = invoiceID;
                hist.Query.Load();

                return hist;
            }
            catch (Exception ex)
            {
                ErrorLog.WriteToFile("View_InvoicePaymentHist.cs", "GetPaymentHistories", ex.StackTrace);
                throw ex;
            }
        }

        public string GetPaymentString()
        {
            return string.Format("{0}: Customer paid {1:C} by {3}. Sale User: {2}", this.s_PaidDate, this.s_PaidAmount != "" ? this.PaidAmount : 0, this.s_FullName, this.PaymentMethodName);
        }
    }
}
